// Linear search

# include <iostream.h>
# include <conio.h>

class LinearSearch {
  int size, key;
  int a[100];
public:
  void get();
  void search();
};

void LinearSearch::get() {
  cout << "Enter Array size: ";
  cin >> size;
  int i = 0;
  for(i = 0; i < size; i++) {
    cout << "Enter array element no." << i+1 << ": ";
    cin >> a[i];
  }
}

void LinearSearch::search() {
  cout << "Enter the number to find: ";
  cin >> key;
  int i,j = 0;
  for(i = 0; i < size; i++) {
    if(key == a[i]) {
      cout << "Match Found at postion " << i+1  << " !";
      j++;
      break;
    }
  }
  if(!j) {
    cout << "Not Found!";
  }
}

void main() {
  clrscr();
  LinearSearch ls;
  ls.get();
  ls.search();
  getch();
}